<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 100px;
            height: 100px;
        }

        ul {
            width: 400px;
            display: flex;
            gap: 50px 25px;
            flex-wrap: wrap;
            border: 1px solid red;
            margin-top: 40px;
        }

        li {
            width: 100px;
        }
        p{
            position: absolute;
            top: -20px;
        }
    </style>
</head>

<body>
    <div id="app">
        <ul>
            <p>这是一个文字</p>
            <li v-for="(items,index) in shoplist" @click="downClick(index)">
                
                <img :src="items.src"></img>
                <div>{{items.price}}</div>
                <div>{{items.id}}</div>
                <div>{{items.name}}</div>
            </li>


        </ul>
    </div>

    <script src="./vue.js"></script>
    

    <script>
        new Vue({
            el: "#app",
            data() {
                return {
                    shoplist: [{
                            price: 2654,
                            id: 1,
                            src: "https://img0.baidu.com/it/u=1595341173,17592285&fm=253&fmt=auto&app=138&f=JPEG?w=350&h=301",
                            name: "iphone"
                        },
                        {
                            price: 1115,
                            id: 2,
                            src: "https://img2.baidu.com/it/u=4100002174,1012494193&fm=253&fmt=auto?w=640&h=400",
                            name: "小米"
                        },
                        {
                            price: 1565,
                            id: 3,
                            src: "https://img0.baidu.com/it/u=3030474572,550627915&fm=253&fmt=auto?w=598&h=315",
                            name: "红米"
                        },
                        {
                            price: 5652,
                            id: 4,
                            src: "https://img0.baidu.com/it/u=3766326678,988822085&fm=253&fmt=auto?w=640&h=360",
                            name: "oppo"
                        },
                        {
                            price: 6233,
                            id: 5,
                            src: "https://img1.baidu.com/it/u=565151633,1110239639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=622",
                            name: "华为"
                        },
                        {
                            price: 2456,
                            id: 6,
                            src: "https://img2.baidu.com/it/u=2414657495,2728385385&fm=253&fmt=auto&app=138&f=PNG?w=499&h=315",
                            name: "iphone13"
                        },
                        {
                            price: 2654,
                            id: 7,
                            src: "https://img0.baidu.com/it/u=1595341173,17592285&fm=253&fmt=auto&app=138&f=JPEG?w=350&h=301",
                            name: "iphone"
                        },
                        {
                            price: 1115,
                            id: 8,
                            src: "https://img2.baidu.com/it/u=4100002174,1012494193&fm=253&fmt=auto?w=640&h=400",
                            name: "小米"
                        },
                        {
                            price: 1565,
                            id: 9,
                            src: "https://img0.baidu.com/it/u=3030474572,550627915&fm=253&fmt=auto?w=598&h=315",
                            name: "红米"
                        },
                        {
                            price: 5652,
                            id: 10,
                            src: "https://img0.baidu.com/it/u=3766326678,988822085&fm=253&fmt=auto?w=640&h=360",
                            name: "oppo"
                        },
                        {
                            price: 6233,
                            id: 11,
                            src: "https://img1.baidu.com/it/u=565151633,1110239639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=622",
                            name: "华为"
                        },
                        {
                            price: 2456,
                            id: 12,
                            src: "https://img2.baidu.com/it/u=2414657495,2728385385&fm=253&fmt=auto&app=138&f=PNG?w=499&h=315",
                            name: "iphone13"
                        }
                    ],
                    shopdata:null
                }
            },
            methods:{
                downClick(i){
                    this.shopdata=i
                    console.log(this.shopdata);
                }
            },
            

        })
    </script>
</body>

</html>